<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>编辑用户</title>
  <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui.css" />
  <script src="${pageContext.request.contextPath}/static/layui.js"></script>
</head>
<body>
<div class="layui-container">
  <h2>编辑用户信息</h2>
  <form class="layui-form" action="${pageContext.request.contextPath}/administrator/editUser" method="post">
    <input type="hidden" name="userId" value="${user.id}" />

    <div class="layui-form-item">
      <label class="layui-form-label">用户名</label>
      <div class="layui-input-block">
        <input type="text" name="username" value="${user.username}" required class="layui-input" />
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">邮箱</label>
      <div class="layui-input-block">
        <input type="email" name="email" value="${user.email}" required class="layui-input" />
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">角色</label>
      <div class="layui-input-block">
        <select name="role" required class="layui-input">
          <option value="admin" ${user.role == 'admin' ? 'selected' : ''}>管理员</option>
          <option value="user" ${user.role == 'user' ? 'selected' : ''}>普通用户</option>
        </select>
      </div>
    </div>

    <div class="layui-form-item">
      <div class="layui-input-block">
        <button class="layui-btn" type="submit">提交</button>
      </div>
    </div>
  </form>
</div>
</body>
</html>
